Skip to content

fix(helm): restore backward-compat discord rendering for per-agent configs#417

Closed
JARVIS-coding-Agent wants to merge 3 commits intoopenabdev:mainfrom
JARVIS-coding-Agent:fix/helm-discord-backward-compat
Closed

fix(helm): restore backward-compat discord rendering for per-agent configs#417
JARVIS-coding-Agent wants to merge 3 commits intoopenabdev:mainfrom
JARVIS-coding-Agent:fix/helm-discord-backward-compat

Conversation

@JARVIS-coding-Agent
Copy link
Copy Markdown
Contributor

Context

Upgrading from chart 0.7.6 → 0.7.7 causes per-agent (non-default) deployments to crash with no adapter configured because the [discord] TOML section is not rendered for agents that lack the new discord.enabled field. This contradicts the backward-compatible intent of #394.

Closes #416

Summary

Replace the strict ($cfg.discord).enabled boolean check in templates/configmap.yaml with a backward-compatible condition that also considers the presence of botToken, so existing 0.7.6 values files work without modification on upgrade.

Changes

  • charts/openab/templates/configmap.yaml: one-line change to the discord rendering condition
discord.enabled discord.botToken Result
true (any) ✅ Rendered — explicit opt-in
(absent) present ✅ Rendered — backward-compat with 0.7.6
false (any) ❌ Skipped — explicit opt-out
(absent) (absent) ❌ Skipped — no discord config

Discord Discussion URL: https://discord.com/channels/1491295327620169908/1494495364655612095

@JARVIS-coding-Agent
Copy link
Copy Markdown
Contributor Author

Pre-Review Self-Check

Issue 驗收(對照 #416

  • 唯一需求:修復 per-agent discord backward-compat — 一行改動完全對應
  • 無 scope creep — 只改 configmap.yaml 的 discord rendering condition
  • 四種情境驗證通過:
discord.enabled discord.botToken Result
true (any) ✅ Rendered — explicit opt-in
(absent) present ✅ Rendered — backward-compat with 0.7.6
false (any) ❌ Skipped — explicit opt-out
(absent) (absent) ❌ Skipped — no discord config

Code 品質

  • git diff origin/main 全部看過,只有一行變更
  • 無 debug log / print 殘留
  • 無 hardcoded 值(條件式純 template 邏輯)
  • 不涉及錯誤處理變更
  • 無需更新註解

整合檢查

  • Helm template test — 本地無 helm 環境,無法跑 helm template(依賴 CI)
  • 不影響 slack、agent、pool、reactions、stt 等其他 section
  • 不影響 values.yaml 或其他 template 檔案

安全性

  • .env、token、敏感資訊
  • 不涉及使用者輸入驗證變更(既有的 channel ID regex 檢查不受影響)

…nfigs

When upgrading from 0.7.6 to 0.7.7, per-agent discord configs that lack
the new discord.enabled field fail to render the [discord] TOML section,
causing pods to crash with 'no adapter configured'.

Replace the strict boolean check with a backward-compatible condition
that also considers the presence of botToken, matching the intent of openabdev#394.

Closes openabdev#416
@JARVIS-coding-Agent JARVIS-coding-Agent force-pushed the fix/helm-discord-backward-compat branch from d18b00a to 081e46d Compare April 17, 2026 01:05
…OTES

Replace the looser `or (enabled, botToken)` check with the same
`botToken`-gated condition used by the other three templates, preventing
configmap from rendering [discord] when no token is available.
Also switches pipe syntax to function-call syntax for consistency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@JARVIS-coding-Agent
Copy link
Copy Markdown
Contributor Author

Reviewer 的兩點都準確,已在 69c2aa5 修正:

🔴 Suggested changes — 條件對齊

條件改回與 secret.yaml / deployment.yaml / NOTES.txt 完全一致:

{{- if and (ne (toString ($cfg.discord).enabled) "false") ($cfg.discord).botToken }}

原本的 (or ($cfg.discord).enabled ($cfg.discord).botToken) 確實會在 enabled: true + 無 botToken 的情況下讓 configmap 渲染 [discord] section,但 secret/deployment 不會跟進 → runtime 拿到空字串 bot_token。這是個真實的 runtime error 路徑,不是只有語義分歧。

🟡 NIT — pipe 語法

同時換成 function call 語法 toString ($cfg.discord).enabled,與其他 templates 風格一致。

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

Update test fixtures to supply discord.botToken where [discord] section
is expected to render, matching the condition aligned with secret.yaml
and deployment.yaml. Replace the "enabled=true without botToken renders"
case with its inverse to document the new gate semantics.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@pahud pahud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for identifying the backward-compat issue — the root cause analysis is spot on.

However, we'd prefer to solve this with explicit defaults rather than inference logic. The botToken-presence fallback adds implicit magic that's hard to reason about and maintain.

Preferred approach: Set discord.enabled: true and slack.enabled: true in the chart's values.yaml defaults. This way:

  • Template keeps the strict enabled check — one code path, no guessing
  • Old 0.7.6 values files (no enabled field) inherit the default true from the chart → backward-compat for free
  • Explicit opt-out via enabled: false when needed
  • Missing botToken with enabled: true → loud startup error instead of silent skip (better DX)

Closing this in favor of that approach.

@pahud
Copy link
Copy Markdown
Collaborator

pahud commented Apr 17, 2026

Closing in favor of the explicit-defaults approach described in the review. Will open a new PR with discord.enabled: true and slack.enabled: true as chart defaults.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(helm): agents.*.discord not rendered on upgrade from 0.7.6 — discord.enabled backward-compat missing for per-agent configs

2 participants